<template>
	<view class="customer-slot">
		<view class="clickable" @click="copy(`${receiverName} ${receiverPhone} ${receiverAddress}`)">
			<text>{{ receiverName }} {{ receiverPhone || '--' }}</text>
			<text class="address">{{ receiverAddress }}</text>
		</view>

		<u-tag
			@click="$emit('payHistory', payload)"
			:text="`平台下单${orderCount}次  复购下单${orderCount}次`"
			type="warning"
			plain
			size="mini"
			style="color: #ef5c5c; margin-top: 8rpx"
		/>
	</view>
</template>

<script setup lang="ts">
const props = defineProps<{
	receiverName: string;
	receiverPhone?: string;
	receiverAddress: string;
	orderCount?: number;
	payload: any;
}>();

defineEmits(['payHistory']);

const copy = (text: string) => {
	uni.setClipboardData({
		data: text,
		success: () => uni.showToast({ title: '已复制', icon: 'none' })
	});
};
</script>

<style scoped>
.customer-slot {
	font-size: 28rpx;
}
.address {
	display: block;
	font-size: 26rpx;
	color: #666;
	margin-top: 4rpx;
}
</style>